#include <bits/stdc++.h>
#define int long long
using namespace std;

void solve() {
    int n;
    cin >> n;
    if (n == 3) {
        cout << 3 << endl;
        return;
    }
    vector<pair<int, int>> m(n);
    vector<int> x(n), y(n);
    for (int i = 0; i < n; ++i) {
        cin >> m[i].first >> m[i].second;
        x[i] = m[i].first;
        y[i] = m[i].second;
    }
    sort(x.begin(), x.end());
    sort(y.begin(), y.end());
    int a = (x.back() - x[0] + 1) * (y.back() - y[0] + 1);
    int min_a = a;
    for (int i = 0; i < n; ++i) {
        int xi = m[i].first, yi = m[i].second;
        int x_min = x[0] == xi ? (n > 1 ? x[1] : xi) : x[0];
        int x_max = x.back() == xi ? (n > 1 ? x[n - 2] : xi) : x.back();
        int y_min = y[0] == yi ? (n > 1 ? y[1] : yi) : y[0];
        int y_max = y.back() == yi ? (n > 1 ? y[n - 2] : yi) : y.back();
        int ai = (x_max - x_min + 1) * (y_max - y_min + 1);
        if (ai < min_a)
            min_a = ai;
    }
    cout << min_a << '\n';
}

signed main() {
    ios::sync_with_stdio(0);
    cin.tie(0);
    int t;
    cin >> t;
    while (t--) {
        solve();
    }
    return 0;
}
